import axios from '@/utils/request'

//请求班组信息
export const getPg = ()=>{
    let pgs = axios.get('/index/admin/users/pgs')
    return pgs
}

//请求用户信息
export const getUsers = (form)=>{
    // let users = await axios.get('/index/admin/users/usersinfo',{params:form})  
    let users = axios.post('/index/admin/users/usersinfo',{form})  
    return users
}

//更新、删除、新增单个用户
/**
 * 
 * @param {*} type 处理类型
 * @param {*} form 表单
 * @param {*} psIsChange 密码是否修改，默认false，只有update是才需要判断
 * @returns newUser 响应结果
 */
export async function handleUser(type,form,psIsChange=false){
    let newUser = await axios.post('/index/admin/users/handleUser',{type,form,psIsChange})
    return newUser
}

//批量更新、删除、新增用户
export async function batchHandleUser(type,form){
    let newUsers = await axios.post('/index/admin/users/batchHandleUsers',{type,form})
    return newUsers
}